//
//  MYShopDetailsCommentHeaderView.swift
//  MuYing
//
//  Created by tbb on 2019/7/29.
//  Copyright © 2019 TBB. All rights reserved.
//

import UIKit

class MYShopDetailsCommentHeaderView: MYShopDetailsTitleHeaderView {
    
    @objc lazy var moreBtn: QMUIButton = {
        let moreBtn = QMUIButton(type: .custom);
        moreBtn.imagePosition = .right;
        moreBtn.spacingBetweenImageAndTitle = 0;
        moreBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium);
        moreBtn.setTitleColor(UIColorFromHex(rgbValue: 0xCBCBCB), for: .normal);
        moreBtn.setTitle(kYQLSSwift("更多"), for: .normal);
        moreBtn.setImage(UIImage(named: "ShopDetails_more_icon"), for: .normal);
        return moreBtn;
    }()
    
    @objc lazy var countLb: UILabel = {
        let countLb = UILabel();
        countLb.font = UIFont.systemFont(ofSize: 12, weight: .medium);
        countLb.textColor = appMainTitleColor;
        countLb.text = "---";
        countLb.backgroundColor = appThemeColor;
        countLb.textAlignment = NSTextAlignment.center;
        return countLb;
    }()
    
    override init(reuseIdentifier: String?) {
        super.init(reuseIdentifier: reuseIdentifier);
        self.contentView .addSubview(self.moreBtn);
        self.moreBtn.mas_makeConstraints { (make) in
            make?.centerY.mas_equalTo()(self.titleLb.mas_centerY)?.mas_equalTo()(0);
            make?.right.mas_equalTo()(-12);
            //make?.size.mas_equalTo()(CGSize(width: 44, height: 21));
            make?.height.mas_equalTo()(21);
        }
    }
    
    override func layoutSubviews() {
        super.layoutSubviews();
        
//        self.countLb.sizeToFit();
//        let lbw = self.countLb.width+24.0;
//        self.contentView.addSubview(self.countLb);
//        self.countLb.mas_makeConstraints { (make) in
//            make?.bottom.mas_equalTo()(-11);
//            make?.left.mas_equalTo()(12);
//            make?.size.mas_equalTo()(CGSize(width: lbw, height: 24));
//        }
//        self.countLb.layer.cornerRadius = 12;
//        self.countLb.clipsToBounds = true;
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
